package com.expand.learn.importor.http;

import com.expand.learn.importor.annotation.HTTPRequest;

import java.lang.reflect.Method;

/**
 * @author zhanghaidong
 * @version v1.0
 * @description
 * @date 2020/3/11
 */
public class DemoHttpHandler implements HTTPHandler {

    @Override
    public HttpResult<?> handle(Method method) {
        HTTPRequest request = method.getAnnotation(HTTPRequest.class);
        String url = request.url();
        String methodName = request.httpMethod().name();
        String str = String.format("http request: url=%s and method=%s", url, methodName);
        return new StringHttpResult(str, 200);
    }
}
